#include <iostream>
#include <string>
using namespace std;

int main()
{
	while (1)
	{
		int k;
		cin >> k;
		if (k == 0)
			return 0;
		string ct;
		cin >> ct;
		int cc[101], pc[101];
		int n = ct.length();
		for (int i = 0; i < n; i++)
		{
			if (ct[i] == '_')
				cc[i] = 0;
			else if (ct[i] == '.')
				cc[i] = 27;
			else
				cc[i] = ct[i] - 'a' + 1;
		}
		for (int i = 0; i < n; i++)
			pc[k * i % n] = (cc[i] + i) % 28;
		for (int i = 0; i < n; i++)
		{
			if (pc[i] == 0)
				cout << "_";
			else if (pc[i] == 27)
				cout << ".";
			else
				cout << char(pc[i] - 1 + 'a');
		}
		cout << endl;
	}
}
